package com.liss.boot.java8.stream;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Test19 {
    public static void main(String[] args) {
        String[] arr1 = { "a", "b", "c", "d" };
        String[] arr2 = { "d", "e", "f", "g" };
        Stream<String> stream1 = Stream.of(arr1);
        Stream<String> stream2 = Stream.of(arr2);
//        List<String> newList = Stream.concat(stream1, stream2).distinct().collect(Collectors.toList());
        Set<String> set = Stream.concat(stream1, stream2).collect(Collectors.toSet());
        List<Integer> collect = Stream.iterate(1, x -> x + 2).limit(10).collect(Collectors.toList());
        List<Integer> collect2 = Stream.iterate(1, x -> x + 2).skip(2).limit(5).collect(Collectors.toList());
        System.out.println("流合并：" + set);
        System.out.println("limit：" + collect);
        System.out.println("skip：" + collect2);
    }
}
